<%-- 
 *Workshop 
 *Class ID        : SE0691   
 *Student ID      : SE90009
 *Student Name    : Phạm Nguyễn Nhật Trung
 *Due Date        : Nov 21, 2012, 9:15:45 PM
 *I declare that this assignment is my own work
 *in accordance with FPT Policy.
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="Trackertag" uri="/WEB-INF/tlds/TrackerTag_library" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <LINK REL=StyleSheet HREF="../style/style.css" TYPE="text/css" MEDIA=screen>
        <title>Tracker - Registration</title>
    </head>
    <body>
        <div class="center-form">
            <h1>Account Registration Page</h1>
            <div id="form-register" style="">
                <Form action ='' method='post'>
                    <table border='0' style="padding-top: 5px;">
                        <tr>
                            <td>Username: </td>
                            <td><input type='text' name ='username' style="width: 100%" value=""></td>
                        </tr>
                        <tr>
                            <td>Password: </td>
                            <td><input type ='password' name='password' style="width: 100%" value=""></td>
                        </tr>
                    </table>
                    <br><input class = "bg-color-green" style="color: #fff;" type ='submit' value='Register'>
                    <input class = "bg-color-purple" style="color: #fff;" type='reset'value='Reset'>
                    <button class = "bg-color-gray" type="button" name="Login" style="color: #fff;" onclick="parent.location='login.jsp'">Or, Login Existed Account</button>
                </form>
            </div>
        </div>
        <%
            String name = "", password = "";
            response.setContentType("text/html;charset=UTF-8");
            try {
                /* TODO output your page here. You may use following sample code. */
                if (request.getParameter("username") != null) {
                    try {
                        name = request.getParameter("username").trim();
                        password = request.getParameter("password").trim();
//                        out.println("<div style=\"width:800px; margin:0 auto; padding-top: 250px\"><h3>Login Failed!</h3></div>");

                    } catch (Exception e) {
                        out.println("<div style=\"width:800px; margin:0 auto; padding-top: 250px\"><h3>" + e.getMessage() + "</h3></div>");
                    }
                }
            } catch (Exception e) {
                out.println("<div style=\"width:800px; margin:0 auto; padding-top: 250px\"><h3>" + e.getMessage() + "</h3></div>");
            } finally {
                //out.close();
            }
        %>
        <Trackertag:RegisterTagHandler userName="<%= name%>" password="<%= password%>"/>
    </body>
</html>
